<!DOCTYPE html>
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<title>欢迎来到云年管理后台</title>
		<link rel="stylesheet" type="text/css" href="css/main.css" />
		<link rel="stylesheet" type="text/css" href="../mobile/js/layer/css/layui.css" />
		<script src="./js/jquery-1.9.1.js"></script>
		<script src="./js/jquery-3.1.1.min.js"></script>
		<script src="../mobile/js/jquery.cookie.js"></script>
	    <script src="../mobile/js/layer/layui.js"></script>
	    <script src="./js/common.js"></script>
		<script type="text/javascript">
			//访问是否登录,ajax同步请求
			var geturl=url+ "/admin/adminapi/loginRequest";
			$.ajax({
					type: 'get',
					async:false,
					dataType: "json",
					url: geturl,
					success: function (dete) {
						// console.log(dete);
						if(dete == 2){
							// alert('请先登录');
							window.location.href="login.html";
						}

					},error:function(data){
						console.log("请检查您的网络");
					}
				});
			
		</script>
	</head>
	<body id="bg">
<script type="text/javascript">

		var name=$.cookie("tooken");
		
		var geturl=url+ "/Admin/Adminapi/islogin?tooken="+name;

		$.ajax({
			type: 'get',
			dataType: "json",
			url: geturl,
			success: function (data) {
				var suc=data.success;
				alert(data);
				if(suc.code == 4008){
					alert(suc.message);
					window.location.href="login.html";
				}else if(suc.code == 4011){
					alert(suc.message);
					window.location.href="login.html";
				}else if(suc.code == 4000){
					var agent=data.agent;
					var agent_level=agent.agent_level;

					if(agent_level==2){
						$('#agentgrade').html("代理");
					}

					var agent_qq=agent.agent_qq;

					var device=data.device;

					$('#devicenum').html(device.count);
					$('#deviceactivation').html(device.jihuo);

					var order=data.order;
					var money=data.money;
					$('.agentprice').html(money);

					$('#orderlimt').html(order);

					if(agent.agent_name==null||agent.agent_name==undefined||agent.agent_name==""){
						$('#agentname').html("千里狐wifi");
					}else{
						$('#agentname').html(agent.agent_name);
					}





				}

			},error:function(data){
				console.log("请检查您的网络");
			}
		});

	// if(username==null||psd==""){

	// 	window.location.href="./login.html";

	// }
</script>
	<div class="container">
		
		<div class="leftsidebar_box">
			
			<div class="logobox">
				<img src="images/left/logo.png" />
			</div>
			
			<div class="line"></div>
			<a href="index.html">
			<dl class="system_log">
				<dt ><i class="iconfont leftmeunicon co-white">&#xe62f;</i>概览<i class="iconfont co-white lefticon">&#xe601;</i></dt>
			</dl>
			</a>
		
			<a href="javascript:void(0);" onclick="changeUrl('setting_information.html',this)"><dl class="custom">
				<dt ><i class="iconfont leftmeunicon co-white">&#xe607;</i>设置<i class="iconfont co-white lefticon">&#xe601;</i></dt>
			</dl></a>
		
			<a href="javascript:void(0);" onclick="changeUrl('menberlist.html',this)"><dl class="channel">
				<dt><i class="iconfont leftmeunicon co-white">&#xe628;</i>会员<i class="iconfont co-white lefticon">&#xe601;</i></dt>
			</dl></a>
		
			<a href="javascript:void(0);" onclick="changeUrl('devicelist.html',this)"><dl class="app">
				<dt ><i class="iconfont leftmeunicon co-white">&#xe70b;</i>设备<i class="iconfont co-white lefticon">&#xe601;</i></dt>
			</dl></a>
		
			<dl class="cloud">
				<dt><i class="iconfont leftmeunicon co-white">&#xe625;</i>订单<i class="iconfont co-white lefticon">&#xe601;</i></dt>
				<dd class="first_dd"><a href="javascript:void(0);" onclick="changeUrl('orderlist.html',this)">订单记录</a></dd>
				<dd><a href="javascript:void(0);" onclick="changeUrl('commissionrecord.html',this)">佣金记录</a></dd>
			</dl>
		
			<dl class="syetem_management">
				<dt><i class="iconfont leftmeunicon co-white">&#xe662;</i>代理<i class="iconfont co-white lefticon">&#xe601;</i></dt>
				<!-- <dd class="first_dd"><a href="#">店铺管理</a></dd> -->
				<dd><a href="javascript:void(0);" onclick="changeUrl('agentone.html',this)">一级代理</a></dd>
				<dd><a href="javascript:void(0);" onclick="changeUrl('agenttwo.html',this)">二级代理</a></dd>
			</dl>
		
		
		</div>
	
	
		<div class="rightsidebar_box">
			<div class="righttop">
				<span class="iconfont hidemeunbtn">&#xe63d;</span>
				<span class="iconfont openmeunbtn ">&#xe626;</span>
				<div class="adminbox">
					<div class="admininfo">
						<table cellpadding="0" cellpadding="0" width="100%">
							<tr>
								<td>
									<img src="images/left/seach_btn.png" alt="" class="adminseach" />
								</td>
								
								<td>
									<img src="images/left/adminhead.png" class="headimg" />
								</td>
								
								<td>
									<p class="adminname">admin</p>
									<p class="adminspecific">ip:<span class="log_ips"></span></p>
									<p class="adminspecific">上次登录时间：<span class="log_times"></span></p>
								</td>
								
								<td>
									<a href="index.html"><img src="images/left/refresh_btn.png" class="adminbtn" /></a>
								</td>
								
								<td>
									<a href="index.html"><img src="images/left/refresh_btn.png" class="adminbtn" /></a>
								</td>
								
								<td>
									<img src="images/left/index_btn.png" class="adminbtn" />
								</td>
								
								<td>
									<a href="javascript:void(0)" onclick="loginout()"><img src="images/left/exit_btn.png" class="adminbtn" /></a>
								</td>

								
							</tr>
						</table>
					</div>
				</div>
				<div class="clear"></div>
			</div>
			
			<iframe width="100%" style="overflow-y: auto;min-height: 1000px;" frameborder="0" class="iframes" src="homepage.html" scrolling="yes"></iframe>
		</div>
		
		<div class="clear"></div>
	</div>


<script type="text/javascript">
//退出登录
function loginout(){
	var geturl=url+ "/admin/adminapi/loginoutRequest";
	$.ajax({
			type: 'get',
			dataType: "json",
			url: geturl,
			success: function (data) {
				// console.log(data);
				if(data == 1){
					window.location.href="login.html";
				}

			},error:function(data){
				console.log("请检查您的网络");
			}
		});
	// window.location.href="login.html";
}
//iframe切换跳转
function changeUrl(url,id){
	$('.iframes').attr('src',url);
	// $(id).find('dl>dt').css('color','rgb(53, 196, 249) !important');
	// $(id).siblings().css('color','rgb(53, 196, #fff) !important');
}
$(".leftsidebar_box dt").css({"background-color":"#0E192B"});
//$(".leftsidebar_box dt img").attr("src","images/left/select_xl01.png");
$(function(){
	$(".leftsidebar_box dd").hide();
	$(".leftsidebar_box dt").click(function(){
		$(".leftsidebar_box dt").css({"background-color":"#0E192B"});
		$(this).css({"background-color": "#192A45","color":"#35C4F9"});
		$(this).find("i").css({"color":"#35C4F9"});
		$(this).parent().siblings().children("dt").css("color","white");
		$(this).parent().siblings().children("dt").find("i").css("color","white");
		$(this).parent().find('dd').removeClass("menu_chioce");
		//$(".leftsidebar_box dt img").attr("src","images/left/select_xl01.png");
		//$(this).parent().find('img').attr("src","images/left/select_xl.png");
		$(".menu_chioce").slideUp(); 
		$(this).parent().find('dd').slideToggle();
		$(this).parent().find('dd').addClass("menu_chioce");
	});

	//获取到上次登录的数据
	var geturl=url+ "/admin/adminapi/adminLogs";
	$.ajax({
			type: 'get',
			async:false,
			dataType: "json",
			url: geturl,
			success: function (dete) {
				// console.log(dete);
				$('.log_ips').html(dete.log_ip);
				$('.log_times').html(dete.log_time);
			},error:function(data){
				console.log("请检查您的网络");
			}
		});
})

/*窗口的改变*/
$(window).resize(function(){
	if($('.leftsidebar_box').width()==168){
		$('.rightsidebar_box').css({"left":168});
	}else{
		$('.rightsidebar_box').css({"left":"10%"});
	}
})



</script>

</body>
</html>
